#ifndef __LING_BUDDY_H__
#define __LING_BUDDY_H__
#include "config.h"
#include "stdint.h"
#include "list.h"

struct ppage
{
    struct page* page;
    int size;       //标识申请的长度
};

struct buddy
{
    struct zone *manage_zone;      //管理的zone

};

#define POWER2(num)     (1<<num)
#define ALIGN_DOWN(num,align_size)  ((num) & (~(align_size - 1)))
#define ALIGN_UP(num,align_size) (((num + (align_size -1))) & (~(align_size - 1)))


void zone_init();
void buddy_alloctor_init();
void show_buddy_all_free_ares();
void buddy_free_pages(struct page * p);
struct page* buddy_alloc_pages(int order);


static inline struct page* get_align_down_buddy_page(struct page* p,int order);

static inline void memlist_out(struct zone*z ,struct page* p);
static inline void memlist_in(struct zone*z ,struct page* p);

#endif